	  
	  <?php $amounts = explode(',', Cookie::get('amounts')); ?>
	  <?php $index = 0; ?>
	  <?php $total = 0; ?>
	  <?php foreach($items as $item): ?>
		<?php $price = $item->item->price*$amounts[$index]?>
			<?php foreach ($item->item->promotions->find_all() as $promotion): ?>
				<?php if($promotion->discount_type == 'percent'):?>
					<?php if(($promotion->starting_date < strtotime('now')) && (strtotime('now') < $promotion->ending_date)): ?>
						<?php $price = $price*(1 - ($promotion->discount/100)); ?>
					<?php endif; ?>
				<?php endif; ?>
				<?php if($promotion->discount_type == 'amount'): ?>
					<?php if(($promotion->starting_date < strtotime('now')) && (strtotime('now') < $promotion->ending_date)): ?>
						<?php $price = $price - $promotion->discount;?>
					<?php endif; ?>
				<?php endif; ?>
			<?php endforeach; ?>
		<?php $total += $price; ?>
		<?php $index++; ?>
	  <?php endforeach; ?>
	  <div class="shopping_cart">
        <div class="title_box">Shopping Cart</div>
        <div class="cart_details"> <?php echo $num_items; ?> items <br />
          <span class="border_cart"></span> Total: <span class="price"><?php echo '$'.$total;?></span> </div>
        <div class="cart_icon"><?php echo Html::anchor('cart/index', Html::image('media/user/images/shoppingcart.png', array('width'=>35, 'height'=>35))); ?></div>
      </div>